package 力扣日常刷题.木22一月.第09天0117;

import java.util.Arrays;

/**
 * @author 帅小伙
 * @date 2022/1/17
 * @description
 */
public class Demo02动态规划中等统计字典序元音字符串的数目 {


    public int countVowelStrings(int n) {
        int[] dp = new int[5];
        int[] tdp = new int[5];
        for (int i = 0; i < 5; i++) {
            dp[i] = 1;
        }

        for (int i = 1; i < n; i++) {
            for (int j = 0; j < 5; j++) {
                for (int k = 0; k <= j; k++) {
                    tdp[j] += dp[k];
                }
            }
            System.arraycopy(tdp, 0, dp, 0, 5);
            Arrays.fill(tdp,0);
        }
        int ans = 0;
        for (int i = 0; i < 5; i++) {
            ans += dp[i];
        }
        return ans;
    }
}
